package com.itheima.Service.Impl;

import com.itheima.Mapper.DepartmentMapper;
import com.itheima.Pojo.*;
import com.itheima.Service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class DepartmentServiceImpl implements DepartmentService {

    @Autowired
    private DepartmentMapper departmentMapper;

    @Override
    public void updateByCode(Department department) {
        departmentMapper.updateByICode(department);
    }

    @Override
    public void addDepartment(Department department) {
        departmentMapper.addDepartment(department);
    }

    @Override
    public void deleteByCode(Integer code) {
        departmentMapper.deleteById(code);
    }

    @Override
    public List<Department> getAllDepartment() {
        return departmentMapper.SelectAll();
    }
}
